if(SERVER) then
	AddCSLuaFile("shared.lua")
	SWEP.AutoSwitchTo		= false
	SWEP.AutoSwitchFrom		= false
end

SWEP.PrintName      = "Medic Kit"   
SWEP.Slot         = 5
SWEP.SlotPos            = 7
SWEP.Description        = "Heals the wounded and cures poison"
SWEP.Contact            = ""
SWEP.Purpose            = ""
SWEP.Instructions      = "Left Click to heal player in front of user."

 
SWEP.Spawnable      = true --  Change to false to make Admin only.
SWEP.AdminSpawnable  = true
 
SWEP.ViewModelFOV			= 80
SWEP.ViewModel			= "models/items/v_medkit2.mdl"
SWEP.WorldModel			= "models/items/w_medkit.mdl"

SWEP.Primary.Recoil  = 0
SWEP.Primary.ClipSize      = -1
SWEP.Primary.DefaultClip    = 1
SWEP.Primary.Automatic    = false
SWEP.Primary.Delay    = 2
SWEP.Primary.Ammo      = "none"
 
SWEP.Secondary.Recoil      = 0
SWEP.Secondary.ClipSize  = -1
SWEP.Secondary.DefaultClip  = 1
SWEP.Secondary.Automatic    = false
SWEP.Secondary.Delay        = .5
SWEP.Secondary.Ammo  = "none"
 
function SWEP:PrimaryAttack()
 
	self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
 
	trace = {}
		trace.start = self.Owner:GetShootPos()
		trace.endpos = trace.start + (self.Owner:GetAimVector() * 105)
		trace.filter = { self.Owner, self.Weapon }
	tr = util.TraceLine(trace)
 
	if (tr.HitNonWorld) then
		local enthit = tr.Entity

		if enthit:IsPlayer() then
			if(enthit:Health() < enthit:GetMaxHealth()) then
				enthit:SetHealth(enthit:GetMaxHealth())
				self.Owner:PrintMessage(HUD_PRINTTALK, "*Medic Kit* Healing Player.")
				enthit:EmitSound("HealthVial.Touch")
			end
		end
	end
end 
	 

function SWEP:SecondaryAttack()

end

function SWEP:DrawWeaponSelection(x, y, wide, tall, alpha)
	draw.SimpleText("F", "CSSelectIcons", x + wide/2, (y + tall*0.2)-10, Color(255, 210, 0, 255), TEXT_ALIGN_CENTER)
end
